package text;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Scanner;

public class Text01 {
    public static void main(String[] args) throws IOException {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请按照顺序用户名,密码,别名,年龄");
        String name=scanner.next();
        String pwd=scanner.next();
        String nick=scanner.next();
        int age=scanner.nextInt();
        User user=new User(name,pwd,nick,age);
        FileOutputStream fos=new FileOutputStream(name+".obj");
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        oos.writeObject(user);
        System.out.println(user);
        System.out.println("写出完毕");
        oos.close();
    }
}
